package com.info.zhiduoduo.repository.mapper.system;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.entity.system.SystemOperationLog;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  系统操作日志
 * Mapper 接口
 * </p>
 *
 * @author bob
 * @since 2021-11-29
 */
public interface SystemOperationLogMapper extends BaseMapper<SystemOperationLog> {

	@Select(" select * from zdd_system_operation_log " +
			" where name like '%${name}%' " +
			" and if(#{type}=0, 1=1, type = #{type}) " +
			" and if(#{userType} < 0, 1=1, user_type = #{userType}) " +
			" and username like '%${username}%' " +
			" and log_time between #{from} and #{to} " +
			" order by log_time desc ")
	List<SystemOperationLog> list(@Param("name") String name, @Param("type") int type, @Param("userType") int userType,
	                              @Param("username") String username, @Param("from") Date from, @Param("to") Date to);

	@Select(" select * from zdd_system_operation_log ")
	List<SystemOperationLog> listAll();
}
